<?php

namespace app\index\controller;

/**
 * 代理操作
 */
class Area extends Base
{
    
    public function getProvince()
    {
        $list = db('cn_area')->where('is_p', 1)->field('p_code,name')->select();

        $this->result($list);
    }

    /**
     * 获取某省下城市列表
     *
     * @param [type] $pcode
     * @return void
     */
    public function getCity()
    {
        $p_code = input('param.p_code');

        $list = db('cn_area')->where(['p_code' => $p_code, 'is_c' => 1])->field('c_code,name')->select();

        $this->result($list);
    }

    /**
     * 获取某市下区县列表
     *
     * @param [type] $c_code
     * @return void
     */
    public function getDist()
    {
        $c_code = input('get.c_code');

        $list = db('cn_area')->where(['c_code' => $c_code, 'is_c' => 0])->select();
        
        $this->result($list);
    }
}
